package cn.edu.xmu.oomall.liquidation.model.bo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Liquidation {
    public enum LiquidationState {
        NOT_REMITTED(0, "未汇出"),
        REMITTED(1, "已汇出");

        private static final Map<Integer, LiquidationState> stateMap;
        static { //由类加载机制，静态块初始加载对应的枚举属性到map中，而不用每次取属性时，遍历一次所有枚举值
            stateMap = new HashMap();
            for (LiquidationState enum1 : values()) {
                stateMap.put(enum1.code, enum1);
            }
        }
        private int code;
        private String description;

        LiquidationState(int code, String description) {
            this.code = code;
            this.description = description;
        }

        public static LiquidationState getTypeByCode(Integer code) {
            return stateMap.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    private Long id;
    
    private Long shopId;

    private String shopName;

    private LocalDateTime liquidDate;

    private Long expressFee;

    private Long commission;

    private Long point;

    private LiquidationState state;

    private Long shopRevenue;

    private Long creatorId;

    private String creatorName;

    private Long modifierId;

    private String modifierName;

    private LocalDateTime gmtCreate;

    private LocalDateTime gmtModified;

}